home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-04 | 2.3 KB | 95 lines | [TEXT/KAHL] |
- /***************************************************** IMPLEMENTATION
- DATE: 9/15/93
- AUTHOR: Eric R. Rosé
-
- CLASS: CPPString
-
- SUPERCLASS: none
-
- This will be the base class for all of our C++ objects
-
- ********************************************************************/
-
- #include "CPPString.h"
- #include <StringTools.h>
- #include <MemoryTools.h>
-
- /*-----------------------------------------------------------------*/
- /*------------------------ PUBLIC METHODS -------------------------*/
- /*-----------------------------------------------------------------*/
-
- CPPString::CPPString (void)
- /* The base class has no data to initialize */
- {
- this->theString = NULL;
- this->ownsString = FALSE;
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPString::CPPString (StringPtr newString, Boolean becomeOwner)
- /* The base class has no data to initialize */
- {
- this->theString = newString;
- this->ownsString = becomeOwner;
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPString::~CPPString (void)
- /* The base class has no data to destroy */
- {
- if (this->ownsString)
- NukePtr(this->theString);
- }
-
- /*-----------------------------------------------------------------*/
-
- Boolean CPPString::Member (char *className)
- {
- if (strcmp(className, CPPString::ClassName()) == 0)
- return TRUE;
- else
- return CPPObject::Member(className);
- }
-
- /*-----------------------------------------------------------------*/
-
- char *CPPString::ClassName (void)
- {
- return "CPPString";
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPObject *CPPString::Clone (void)
- /* The base class has no data to copy */
- {
- CPPString *NewString = new CPPString (this->theString, TRUE);
-
- return (CPPObject *)NewString;
- }
-
- /*-----------------------------------------------------------------*/
-
- StringPtr CPPString::GetString (Boolean getCopy)
- {
- if (getCopy)
- return String2String(this->theString);
- else
- return theString;
- }
-
- /*-----------------------------------------------------------------*/
-
- void CPPString::SetString (StringPtr newString, Boolean becomeOwner)
- {
- if (this->ownsString)
- NukePtr(this->theString);
-
- this->theString = newString;
- this->ownsString = becomeOwner;
- }
-
- /*-----------------------------------------------------------------*/
-